<script>
$(document).ready(function() {
	$('.numberText').change(function() {
		Validate($('.numberText'));
	});
});

function Validate(element) {
	if ($('.numberTypeDDL').val() == "0") {
		var	v =	$(element).val();
		var	valid =	CheckBSNValidation(v);
		if (!valid)	{
			if (v == ""	|| v.length	== 0)
				$('#AccountInputs_REV_Number').html('Er	is geen	BSN	nummer ingevoerd!');
			else if	(isNaN(v))
				$('#AccountInputs_REV_Number').html('Het ingevoerde	nummer is niet numeriek!');
			else
				$('#AccountInputs_REV_Number').html('Dit burgerservicenummer is	niet valide!');

			$('#AccountInputs_REV_Number').show();
		}
		else {
			$('#AccountInputs_REV_Number').hide();
		}
		return valid;
	}
}

function CheckBSNValidation(value) {
	var	bsn	= value.toString().replace(" ",	"");
	if (bsn	== "000000000" || bsn.length !=	9)
		return false;

	if ((9 * bsn.substr(0, 1) +
		 8 * bsn.substr(1, 1) +
		 7 * bsn.substr(2, 1) +
		 6 * bsn.substr(3, 1) +
		 5 * bsn.substr(4, 1) +
		 4 * bsn.substr(5, 1) +
		 3 * bsn.substr(6, 1) +
		 2 * bsn.substr(7, 1)
		 - 1 * bsn.substr(8, 1)) % 11 == 0)	{
		return true;
	}
	return false;
}
</script>

<asp:Panel ID="ModalPanel_minRequried" runat="server" Visible="false" CssClass="modalPopup"	>
	<p>
		<asp:Label runat="server" ID="Label1"></asp:Label> 
		<p style="text-align: center">
			<asp:Button	ID="btn_mrYes" runat="server" Text="Ja"	OnClick="btn_mrYes_Click" Width="100px"	/>
			<asp:Button	ID="btn_mrNo" runat="server" Text="Nee"	OnClick="btn_mrNo_Click" Width="100px"/>
		</p>
	</p>
</asp:Panel>